<%@include file="../viewPartials/header.jsp" %>
<c:url value="Home" var="homeUrl" />


<h1>LinkCollection</h1>

<c:choose>
    <c:when test="${linkCollection == null}">
        LinkCollection not found <a href="${homeUrl}">Back</a>
    </c:when>
    <c:when test="${linkCollection != null}">
        
        <c:if test="${formErrors.size() > 0}">
            <div class="formErrors">
                <c:forEach var="error" items="${formErrors}">
                    ${fn:escapeXml(error)}<br>
                </c:forEach>
            </div>
        </c:if>

        <c:if test="${param.success == 'true'}">
            <div class="success">LinkCollection updated!</div>
        </c:if>
        
        <form method="post">
        <table class="tblForm">
            <tr>
                <td width="80">Name</td>
                <td><input name="name" type="text" value="${fn:escapeXml(linkCollection.name)}"></td>
            </tr>
            <tr>
                <td><label>Folder</label></td>
                <td>
                    <input value="${linkCollection.parent.id}"
                            data-foldername="${fn:escapeXml(linkCollection.parent.name)}"
                            id="txtFolderId"
                            name="folderId">
                </td>
            </tr>
            <tr>
                <td>Links</td>
                <td><textarea name="links" style="width: 550px; height: 540px;">${fn:escapeXml(linkCollection.links)}</textarea></td>
            </tr>
            <tr>
                <td></td>
                <td><input name="submit" type="submit" value="Save"></td>
            </tr>
        </table>
        </form>
        <a href="${homeUrl}">Back</a>
        
    </c:when>
</c:choose>

<%@include file="../viewPartials/footer.jsp" %>